// pages/index/index.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    indicatorDots:true,
    autoplay:true,
    interval:5000,
    circular:true,
    imgUrls:[
      "/pages/images/haibao/xiarikuanghuangou.jpg",
      "/pages/images/haibao/fengshan.jpg",
      "/pages/images/haibao/kongtiao.jpg",
    ],

    navs:[{
      "img":"/pages/images/icon/lyhq.png",
      "name":"领优惠券"
    },{
      "img":"/pages/images/icon/smgw.png",
      "name":"扫码购物"
    },{
      "img":"/pages/images/icon/wlcx.png",
      "name":"物流查询"
    },{
      "img":"/pages/images/icon/pt.png",
      "name":"拼团"
    }],
    goods:[{
      "id":"001",//商品标识
      "img":"/pages/images/goods/bingxiang.jpg",//商品图片
      "name":"双变频 一级能效 大容量 双开门家用电冰箱",//商品名称
      "nowPrice":"1999.00",//商品现价
      "oldPrice":"2200.00",//商品原价
      "goodValuation":"99.7",//商品好评率
      "comment":"1000"//商品评论数
      },{
      "id":"002",
      "img":"/pages/images/goods/fengshan.jpg",
      "name":"迷你小风扇 清凉夏日 便携式充电",
      "nowPrice":"29.90",
      "oldPrice":"39.90",
      "goodValuation":"90.0",
      "comment":"2000"
      },{
      "id":"003",
      "img":"/pages/images/goods/jinghuaqi.jpg",
      "name":"空气净化器 除异味 低噪设计 经典升级",
      "nowPrice":"1299.00",
      "oldPrice":"1399.00",
      "goodValuation":"96.9",
      "comment":"900"
      }]
  },


  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {

  },
search(){
  wx.navigateTo({
    url: '../search/search',
  })
},
onShareAppMessage(){
  return{
    title:"家电商城欢迎你",
    path:'/pages/index'
  }
},
buying(event){
  wx.navigateTo({
    url:'/pages/buying/buying',
    success:(res) => {
      res.eventChannel.emit('sendData',{
        message: 'Hello',
        good:this.data.goods[event.currentTarget.dataset.id]
      })
    }
  })
}
})
